/**
 * <p>
 * Created on 2006-6-12 19:05:03 <br>
 * Copyright (c) 2006, All rights reserved.
 * </p>
 * @author Widen
 */
package com.widen.prima.editor.finance;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;

import com.widen.prima.finance.entites.AccountSubjectBo;
import com.widen.prima.util.Util;

public class SubjectBalanceLabelProvider
    implements ITableLabelProvider
{
    /**
     * Returns the image
     * 
     * @param element the element
     * @param columnIndex the column index
     * @return Image
     */
    public Image getColumnImage(Object element, int columnIndex)
    {
        return null;
    }

    /**
     * Returns the column text
     * 
     * @param element the element
     * @param columnIndex the column index
     * @return String
     */
    public String getColumnText(Object element, int columnIndex)
    {
        AccountSubjectBo subjectBo = (AccountSubjectBo) element;
        switch (columnIndex)
        {
            case 0:
                int subjectType = subjectBo.getSubjectType().getValue();
                return Util.getSubjectType(subjectType);
            case 1:
                return subjectBo.getFullName();
            case 2:
                int direction = subjectBo.getDirection().getValue();
                return Util.getDirection(direction);
            case 3:
                return Util.double_formatter
                    .format(subjectBo.getCurrentMoney());
        }
        return null;
    }

    /**
     * Adds a listener
     * 
     * @param listener the listener
     */
    public void addListener(ILabelProviderListener listener)
    {
        // Ignore it
    }

    /**
     * Disposes any created resources
     */
    public void dispose()
    {
        // Nothing to dispose
    }

    /**
     * Returns whether altering this property on this element will affect the
     * label
     * 
     * @param element the element
     * @param property the property
     * @return boolean
     */
    public boolean isLabelProperty(Object element, String property)
    {
        return false;
    }

    /**
     * Removes a listener
     * 
     * @param listener the listener
     */
    public void removeListener(ILabelProviderListener listener)
    {
        // Ignore
    }
}
